﻿using GameFramework.Resource;
using GameFramework.UI;
using System.Collections.Generic;
using UnityEngine;
using UnityGameFramework.Runtime;
using ProcedureOwner = GameFramework.Fsm.IFsm<GameFramework.Procedure.IProcedureManager>;

namespace VRLauncher
{
    /// <summary>
    /// 流程 => 闪屏。
    /// </summary>
    public class ProcedureSplash : ProcedureBase
    {

        public override bool UseNativeDialog => true;


        protected override void OnUpdate(ProcedureOwner procedureOwner, float elapseSeconds, float realElapseSeconds)
        {
            base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);

            // TODO: 这里可以播放一个 Splash 动画
            // ...
            switch (MessagingHelper.playMode)
            {
                case YooAsset.EPlayMode.EditorSimulateMode:
                    {
                        //编辑器模式
                        Log.Info("Editor resource mode detected.");
                        ChangeState<ProcedurePreload>(procedureOwner);
                        break;
                    }
                case YooAsset.EPlayMode.OfflinePlayMode:
                    {
                        // 单机模式
                        Log.Info("Package resource mode detected.");
                        //Log.Error("单机模式未实现");
                        //ChangeState<ProcedureInitResources>(procedureOwner);
                        ChangeState<ProcedurePreload>(procedureOwner);
                        break;
                    }
                case YooAsset.EPlayMode.HostPlayMode:
                    {
                        // 可更新模式
                        Log.Info("Updatable resource mode detected.");
                        //Log.Error("更新模式未实现");
                        //ChangeState<ProcedureCheckVersion>(procedureOwner);
                        ChangeState<ProcedurePreload>(procedureOwner);
                        break;
                    }
                case YooAsset.EPlayMode.WebPlayMode:
                    {

                        Log.Error("WebPlayMode模式未实现");
                        break;
                    }
            }

        }
    }
}
